# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=py3-random2
pkgver=1.0.1
pkgrel=4
pkgdesc="Python 3 compatible Python 2 random Module"
url="https://pypi.org/project/random2/"
arch="noarch"
license="PSF-2.0"
depends="python3"
makedepends="py3-setuptools"
subpackages="$pkgname-pyc"
source="https://pypi.python.org/packages/source/r/random2/random2-$pkgver.zip"
builddir="$srcdir/random2-$pkgver"

prepare() {
	default_prepare

	# Remove a test that is invalid as of python 3.9
	# Taken from Fedora .spec
	# https://src.fedoraproject.org/rpms/python-random2/blob/rawhide/f/python-random2.spec
	sed -i '/self\.gen\.getrandbits, 0/d' src/tests.py
}

build() {
	python3 setup.py build
}

check() {
	python3 setup.py test
}

package() {
	python3 setup.py install --skip-build --root="$pkgdir"
}

sha512sums="31de31c27bc6e07e99c24d30e97d9ddc3085fe557bcb0725881d4ab0b4c06e6208f64ba6267098c7b1be4f115ad45b399e841beecc90f71da2fb7d82982e75ff  random2-1.0.1.zip"
